import { FetchNotice, INotice, notifyTypeMap } from './interface'

export function transNotices(Notices: FetchNotice[], preUrl: string): INotice[] {
	return Notices.map((notice) => {
		return {
			moid: notice.moid,
			subject: notice.context?.subject ?? '',
			desc: notifyTypeMap[notice.type].desc,
			keyUrl: notice.context?.meetingMoid
				? `${preUrl}/detail.html?meetingMoid=${notice.context?.meetingMoid}`
				: '',
			read_state: notice.read_state ?? 0,
		}
	})
}
